module.exports = function($scope, $stateParams, $state, $modal,$resource,toaster, str2date, date2str){
    var id = $stateParams.id;
    console.log(id);
    /* 分页
    * ========================================= */
    $scope.maxSize = 5;            //最多显示多少个按钮
    $scope.bigCurrentPage = 1;      //当前页码
    $scope.itemsPerPage = 10;         //每页显示几条

    $scope.info = {};
    $scope.search = 'search';
    $scope.getlist = function (search) {
        console.log(search);
        // if(search != 'undefined'){
        //     var para = {
        //         pageNo:$scope.currentPage, 
        //         pageSize:$scope.itemsPerPage,
        //     };
        // } else {
        //     console.log('bushi sousuo');
            if(id != ''){
                console.log('奖品下的'+search);
                if(search === 'undefined'){
                    console.log('搜哟');
                    var para = {
                        pageNo:$scope.bigCurrentPage, 
                        pageSize:$scope.itemsPerPage,
                    };
                } else {
                    console.log('不搜');
                    var para = {
                        pageNo:$scope.bigCurrentPage, 
                        pageSize:$scope.itemsPerPage,
                        goods_id : id
                    };

                }
                
            } else {
                var para = {
                    pageNo:$scope.bigCurrentPage, 
                    pageSize:$scope.itemsPerPage,
                };

            }
        
        
        
        para = angular.extend($scope.info,para); 
        $resource('/api/as/ac/bargaingoods/findBargainGetGoodsList', {}, {}).
        save(para, function (res) {
                if (res.errcode != 0) {
                    toaster.error({title:"",body : res.errmsg});
                    return;
                }
                console.log(res);
                $scope.objs = res.data.results;
                $scope.bigTotalItems = res.data.totalRecord;
        });
    };
    $scope.getlist();	
    $scope.seebargaininfo = function(active_id){
        $state.go('app.bargaininfo',{'active_id' : active_id});
    }
    
    




};